feat(grouper): add slow handle diagnostics#549
Open
Kuchizu wants to merge 5 commits into
Open
Conversation
neSpecc
reviewed
May 4, 2026
neSpecc
previously approved these changes
May 6, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Adds slow-handle diagnostics to the Grouper worker to help pinpoint which parts of handleInternal() contribute most to high end-to-end handle duration.
Changes:
- Introduces
SlowHandleDiagnostics/SlowHandleSessionto time per-handle steps and emit a slow-handle warning with a step breakdown. - Extends
GrouperMetricswith a per-step duration histogram and custom handle-duration buckets. - Adds env-driven diagnostics config (
GROUPER_SLOW_HANDLE_WARN_MS) and instrumentshandleInternal()plus several Mongo operations.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| workers/grouper/src/metrics/slowHandleDiagnostics.ts | New per-handle session helper that measures steps and logs a slow-handle breakdown. |
| workers/grouper/src/metrics/grouperMetrics.ts | Adds GrouperStep + step-duration histogram and custom handle-duration buckets. |
| workers/grouper/src/metrics/config.ts | Adds diagnostics config + env parsing for slow-handle warning threshold. |
| workers/grouper/src/index.ts | Instruments handleInternal() steps, adds slow-handle session usage, and wraps additional Mongo ops for duration metrics. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds Grouper slow-handle diagnostics to identify which processing step causes high handle duration.